import * as echarts from 'echarts';
type EChartsOption = echarts.EChartsOption;
import { local } from '@/assets/MapData/nanchangLocal';
import { nanchang } from '@/assets/map/nanchang';

export default function mapOption(myChart: echarts.ECharts) {
    echarts.registerMap("nanchang", (nanchang as any))
    return {
        title: {
            text: '南昌 Chart ',
            subtext: 'Fake Data',
            left: 'center'
        },
        showLegendSymbol: true,
        tooltip: {
            trigger: 'item',
            textStyle: {
                fontSize: 14,
                lineHeight: 22,
            },
            position: point => {
                // 固定在顶部
                return [point[0] + 50, point[1] - 20];
            },
            formatter: '{b}&emsp;&emsp;<br/>{c}'
        },
        geo: [{

            aspectScale: 0.85, //长宽比
            zoom: 1, //缩放
            show: true,
            map: "nanchang",
            type: "map",
            itemStyle: {
                areaColor: "#2E72BF"
            },
            top:60
        }],

        series: [{
            type: 'map',
            top:60,
            aspectScale: 0.85, //长宽比
            zoom:  1, //缩放
            mapType: 'nanchang', // 自定义扩展图表类型
            itemStyle: {
                normal: {
                    // 背景渐变色
                    areaColor: {
                        type: 'linear-gradient',
                        x: 0,
                        y: 300,
                        x2: 0,
                        y2: 0,
                        colorStops: [{
                            offset: 0,
                            color: 'RGBA(19,96,187,0.2)' // 0% 处的颜色
                        }, {
                            offset: 1,
                            color: 'RGBA(7,193,223,0.2)' // 50% 处的颜色
                        }],
                        global: true // 缺省为 false
                    },
                    borderColor: '#4ECEE6',
                    borderWidth: 1,
                },
                emphasis: {
                    areaColor: 'rgba(0,242,252,.4)',
                    borderColor: 'rgba(0,242,252,.6)',
                    borderWidth: 2,
                    shadowBlur: 10,
                    shadowColor: 'rgba(0,242,252,.4)',
                },
            },
           
            data: local,
        }, 
        ]
    } as EChartsOption;
}

